package com.ah.tag;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;
// 自定义标签: 访问标签体,获取标签体中的内容
// 继承：SimpleTagSupport
// 重写：doTag方法
public class MyCustomTag2 extends SimpleTagSupport {
	public void doTag() throws JspException, IOException {
		System.out.println("===自定义标签，示例2");
		StringWriter sw = new StringWriter();
		getJspBody().invoke(sw);
		String s = sw.toString();
		System.out.println("===" + s);
		// ---写到页面上，否则JSP上不显示
		JspContext jspContext = getJspContext();
		JspWriter jspWriter = jspContext.getOut();
		jspWriter.println(s);
	}
}